const MyPromise = require('./04.js')

function p1 () {
  return new MyPromise(function (resolve, reject) {
    setTimeout(() => {
      resolve('p1')
    }, 2000)
  })
}

function p2 () {
  return new MyPromise(function (resolve, reject) {
    // resolve('p2 成功')
    reject('p2 失败')
  })
}

p2()
  .then(value => {
    console.log('==then==', value)
  })
  .catch(reason => {
    console.log('==catch==', reason)
  })